package com.shushan.pages.bean;

import com.android.net.bean.NetBaseBean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: MaketingDataBean
 * @Desciption: //分享营销相关数据bean
 * @author: zhangshihao
 * @date: 2018-05-23
 */
public class MaketingDataBean extends NetBaseBean {

    public MaketingStudyBean maketingStudyBean;
    public MaketingUserBean maketingUserBean;
    private List<MaketingActivityBean> maketingActivityBeanList = new ArrayList<>();

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        JSONObject studyObj = jsonObject.optJSONObject("study");
        maketingStudyBean = new MaketingStudyBean();
        maketingStudyBean.initByJson(studyObj);

        JSONObject userObj = jsonObject.optJSONObject("user");
        maketingUserBean = new MaketingUserBean();
        maketingUserBean.initByJson(userObj);

        JSONArray activityArray = jsonObject.optJSONArray("activity");
        for(int i=0;i<activityArray.length();i++){
            JSONObject jobj = activityArray.optJSONObject(i);
            MaketingActivityBean activityBean = new MaketingActivityBean();
            activityBean.initByJson(jobj);

            maketingActivityBeanList.add(activityBean);
        }

    }

    public List<MaketingActivityBean> getMaketingActivityBeanList() {
        return maketingActivityBeanList;
    }
}
